package net.optix.ip.commands
{
	import com.adobe.cairngorm.business.Responder;
	import com.adobe.cairngorm.commands.Command;
	import com.adobe.cairngorm.control.CairngormEvent;
	
	import mx.collections.ArrayCollection;
	
	import net.optix.ip.business.*;
	import net.optix.ip.events.GetInventionEvent;
	import net.optix.ip.model.ModelLocator;
	import net.optix.ip.vo.BidVO;
	import net.optix.ip.vo.InventionVO;
	import net.optix.ip.vo.ValueVO;
	
	public class GetInventionCommand implements Command, Responder
	{
		// attributes ============================
		private var model : ModelLocator = ModelLocator.getInstance();


		// functions ============================
		public function execute( event:CairngormEvent ) : void
		{
			var myEvent:GetInventionEvent = GetInventionEvent( event );
			
			var delegate:InventionDelegate = new InventionDelegate(  );     
			delegate.getInvention( this , myEvent.inventionID );
			
		}
		
		//----------------------------------------------------------------------------
		public function onResult( event : * = null ) : void
		{
			try
			{		
				model.currentInvention	=	InventionVO.purseInvention(event.result);
			}
			catch(error:Error)
			{
				
			}
		}
		
		//----------------------------------------------------------------------------
		public function onFault( event : * = null ) : void
		{
			trace(event.fault);
		}

	}
}